<?php 
if ($msg != "default") echo $msg_output;
if ($action == "default") {
?>
<p><span class="icon"><img src="images/arrow_left.png" border="0" align="absmiddle" /></span><a href="index.php?section=proposal_reveiw&amp;cid=<?php echo $cid; ?>">Return to <?php echo $header_output_previous; ?></a></p>
<p>Now that you have completed your review of the course proposal, it's time to provide some additional structure in the form of preliminary module, theme, and assignment titles along with a short module overview.</p>
<ul>
  <li>Provide a short (one- to three-paragraph) preliminary overview of each module.</li>
  <li>Each module is listed below with two assignments and two themes, the minimum number JIU suggests for each module. </li>
  <li>To provide the <em>working</em> titles for each module and its associated themes and assignmens, click the &ldquo;Edit Associated Titles&rdquo; link for each module listed below.</li>
  <li>If you feel there should be additional assignments or themes in a particular module, click the appropriate &ldquo;Add...&rdquo; link.</li>
</ul>
<p>Once you are finished, proceed to <a href="index.php?section=proposal_materials&amp;action=add&amp;dbTable=materials&amp;cid=<?php echo $cid; ?>"><?php echo $header_output_next; ?></a>.</p>
<h2><?php echo $row_courses['jiu_course_id']; ?> Module Overviews and Associated Titles</h2>
<?php do { 
$query_assignments = sprintf("SELECT * FROM assignments WHERE cid='%s' AND mid='%s' ORDER BY assign_num ASC", $cid, $row_modules['mid']);
$assignments = mysql_query($query_assignments, $connection) or die(mysql_error());
$row_assignments = mysql_fetch_assoc($assignments);

$query_themes = sprintf("SELECT * FROM themes WHERE cid='%s' AND mid='%s' ORDER BY theme_num ASC", $cid, $row_modules['mid']);
$themes = mysql_query($query_themes, $connection) or die(mysql_error());
$row_themes = mysql_fetch_assoc($themes);
?>
<table class="dataTable">
<tr>
	<th width="10%" nowrap="nowrap"><a name="<?php echo $row_modules['mid']; ?>"></a>Module <?php echo $row_modules['mid']; ?> Title:</th>
	<th colspan="2"><?php if ($row_modules['module_title'] != "") echo $row_modules['module_title']; else { ?><span class="icon"><img src="images/exclamation.png" border="0" align="absmiddle" /></span>No Title Entered<?php } ?></th>
    <th width="1%" nowrap="nowrap"><span class="icon"><img src="images/page_edit.png" border="0" align="absmiddle" /></span><a href="index.php?section=proposal_titles&amp;action=edit&amp;go=setup&amp;dbTable=modules&amp;cid=<?php echo $cid; ?>&amp;mid=<?php echo $row_modules['mid']; ?>">Edit Module <?php echo $row_modules['mid']; ?> Overview and Titles</a></th>
</tr>
	<tr style="background-color: <?php echo $color1; ?>">
        <td class="data" colspan="4"><strong>Overview</strong></td>
    </tr>
    <tr>
		<td class="data" colspan="4"><?php if ($row_modules['module_overview'] != "") echo $row_modules['module_overview']; else { ?><span class="icon"><img src="images/exclamation.png" border="0" align="absmiddle" /></span>No Overview Entered<?php } ?></td>
	</tr>
	<tr style="background-color: <?php echo $color1; ?>">
        <td class="data"><strong>Themes</strong></td>
        <td class="data">&nbsp;</td>
        <td class="data">&nbsp;</td>
        <td width="1%" nowrap="nowrap"><span class="icon"><img src="images/page_add.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?section=proposal_titles&action=add&dbTable=themes&cid=<?php echo $cid; ?>','mid','<?php echo $row_modules['mid']; ?>','Are you sure you want to add a theme to Module <?php echo $row_modules['mid']; ?>?')">Add a Theme to Module <?php echo $row_modules['mid']; ?>?</a></td>
    </tr>
	<?php do { ?>
	<tr>
		<td class="data" nowrap="nowrap">Theme <?php echo $row_themes['theme_num']; ?>:</td>
    	<td class="data" width="35%" nowrap="nowrap"><?php if ($row_themes['theme_title'] != "") echo $row_themes['theme_title']; else { ?><span class="icon"><img src="images/exclamation.png" border="0" align="absmiddle" /></span>No Title Entered<?php } ?></td>
        <td class="data"><?php if ($row_themes['theme_num'] > "2") { ?><span class="icon"><img src="images/bin_closed.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?action=delete&dbTable=themes','id','<?php echo $row_themes['id']; ?>','Are you sure want to delete Module <?php echo $row_modules['mid']; ?>, Theme <?php echo $row_themes['theme_num']; ?>?')">Delete?</a><?php } else echo "&nbsp;"; ?></td>
        <td class="data">&nbsp;</td>
	</tr>
	<?php } while ($row_themes = mysql_fetch_assoc($themes)); ?>
    <tr style="background-color: <?php echo $color1; ?>">
        <td class="data"><strong>Assignments</strong></td>
        <td class="data">&nbsp;</td>
        <td class="data">&nbsp;</td>
        <td width="1%" nowrap="nowrap"><span class="icon"><img src="images/page_add.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?section=proposal_titles&action=add&dbTable=assignments&cid=<?php echo $cid; ?>','mid','<?php echo $row_modules['mid']; ?>','Are you sure you want to add an assignment to Module <?php echo $row_modules['mid']; ?>?')">Add an Assignment to Module <?php echo $row_modules['mid']; ?>?</a></td>
    </tr>
	<?php do { ?>
	<tr>
		<td class="data" nowrap="nowrap">Assignment <?php echo $row_modules['mid'].".".$row_assignments['assign_num']; ?>:</td>
       	<td class="data" width="35%"><?php echo $row_assignments['assign_title']; $check1 = ltrim($row_assignments['assign_title'],"Course Project -"); $check2 = ltrim($row_assignments['assign_title'],"Discussion -"); if (($check1 == "") || ($check2 == "")) { ?><span class="icon"><img src="images/exclamation.png" border="0" align="absmiddle" /></span>No Title Entered<?php } ?></td>
        <td class="data"><?php if ($row_assignments['assign_num'] > "2") { ?><span class="icon"><img src="images/bin_closed.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?action=delete&dbTable=assignments','id','<?php echo $row_assignments['id']; ?>','Are you sure want to delete Module <?php echo $row_modules['mid']; ?>, Assignment <?php echo $row_modules['mid'].".".$row_assignments['assign_num']; ?>?')">Delete?</a><?php } else echo "&nbsp;"; ?></td>
        <td class="data">&nbsp;</td>
	</tr>
	<?php } while ($row_assignments = mysql_fetch_assoc($assignments)); ?>
</table>
<br />
<?php } while ($row_modules = mysql_fetch_assoc($modules)); ?>
<?php 
} // end if ($action == "default")
if (($action == "edit") && (($go == "setup") || ($view == "proposal_detail") || ($view == "course_detail"))) { // For Step 6 - providing initial titles for Modules, Themes, and Assignments.
?>
<?php if (($msg != "4") && ($msg !="5")) { ?>
<div class="info">Add additional themes and assignments <em>before</em> entering any titles.</div>
<?php if ($modal_window == "false") { ?>
<p><span class="icon"><img src="images/arrow_left.png" border="0" align="absmiddle" /></span><a href="<?php echo $_SERVER['HTTP_REFERER']; ?>">Back to Previous</a></p>
<p><span class="icon"><img src="images/arrow_left.png" border="0" align="absmiddle" /></span><a href="index.php?section=proposal_titles&amp;cid=<?php echo $cid; ?>">Back to <?php echo $row_courses['jiu_course_id']; ?> Modules and Associated Titles Overview</a></p>
<?php } ?>
<h2><?php echo $row_courses['jiu_course_id']; ?> Module <?php echo $row_modules['mid']; ?> Overview and Titles</h2>
<?php
if ($go == "setup") {
$query_pd_title = sprintf("SELECT pd_name FROM project_deliverable WHERE cid='%s' AND mid='%s' ORDER BY del_num ASC LIMIT 1", $cid, $row_modules['mid']);
$pd_title = mysql_query($query_pd_title, $connection) or die(mysql_error());
$row_pd_title = mysql_fetch_assoc($pd_title);
}

$query_assignments = sprintf("SELECT * FROM assignments WHERE cid='%s' AND mid='%s' ORDER BY assign_num ASC", $cid, $row_modules['mid']);
$assignments = mysql_query($query_assignments, $connection) or die(mysql_error());
$row_assignments = mysql_fetch_assoc($assignments);
//
$query_themes = sprintf("SELECT * FROM themes WHERE cid='%s' AND mid='%s' ORDER BY theme_num ASC", $cid, $row_modules['mid']);
$themes = mysql_query($query_themes, $connection) or die(mysql_error());
$row_themes = mysql_fetch_assoc($themes);
?>
<div class="stacked">
<span class="icon"><img src="images/disk.png" border="0" align="absmiddle" /></span><input id="Submit" name="Submit" type="submit" class="save_progress_form" value="<?php if (($action == "edit") || ($go == "missing")) echo "Update"; else echo "Save"; ?>">
</div>
<table class="dataTable">
	<input type="hidden" name="id_m" value="<?php echo $row_modules['id']; ?>" />
    <input type="hidden" name="mid" value="<?php echo $row_modules['mid']; ?>" />
<tr style="background-color: <?php echo $color2; ?>">
	<td class="dataLabel">Module <?php echo $row_modules['mid']; ?> Title:</td>
	<td colspan="2" class="data"><input name="module_title" type="text" size="50" value="<?php echo $row_modules['module_title']; ?>"/></td>
    <td width="1%" nowrap="nowrap">&nbsp;</td>
</tr>
	<tr style="background-color: <?php echo $color1; ?>">
        <td class="data" colspan="4"><strong>Overview</strong></td>
    </tr>
    <tr>
		<td class="data" colspan="4"><textarea name="module_overview" cols="60" rows="15" class="mceNoEditor"><?php if ($action == "edit") echo $row_modules['module_overview']; ?></textarea></td>
	</tr>
	<tr style="background-color: <?php echo $color1; ?>">
        <td class="data"><strong>Themes</strong></td>
        <td class="data">&nbsp;</td>
        <td class="data">&nbsp;</td>
        <td width="1%" nowrap="nowrap"><span class="icon"><img src="images/page_add.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?section=proposal_titles&action=add&dbTable=themes&cid=<?php echo $cid; ?>','mid','<?php echo $row_modules['mid']; ?>','Are you sure you want to add a theme to Module <?php echo $row_modules['mid']; ?>?')">Add a Theme to Module <?php echo $row_modules['mid']; ?>?</a></td>
    </tr>
	<?php do { ?>
    <input type="hidden" name="id_t[]" value="<?php echo $row_themes['id']; ?>" />
	<tr>
		<td class="data" nowrap="nowrap" style="vertical-align: middle;">Theme <input name="theme_num<?php echo $row_themes['id']; ?>" type="text" size="2" value="<?php echo $row_themes['theme_num']; ?>" />:</td>
    	<td class="data" width="35%" nowrap="nowrap"><input name="theme_title<?php echo $row_themes['id']; ?>" type="text" size="50" value="<?php echo $row_themes['theme_title']; ?>"/></td>
        <td class="data"><?php if ($row_themes['theme_num'] > "2") { ?><span class="icon"><img src="images/bin_closed.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?action=delete&dbTable=themes','id','<?php echo $row_themes['id']; ?>','Are you sure want to delete Module <?php echo $row_modules['mid']; ?>, Theme <?php echo $row_themes['theme_num']; ?>?')">Delete?</a><?php } else echo "&nbsp;"; ?></td>
        <td class="data">&nbsp;</td>
	</tr>
	<?php } while ($row_themes = mysql_fetch_assoc($themes)); ?>
    <tr style="background-color: <?php echo $color1; ?>">
        <td class="data"><strong>Assignments</strong></td>
        <td class="data">&nbsp;</td>
        <td class="data">&nbsp;</td>
        <td width="1%" nowrap="nowrap"><span class="icon"><img src="images/page_add.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?section=proposal_titles&action=add&dbTable=assignments&cid=<?php echo $cid; ?>','mid','<?php echo $row_modules['mid']; ?>','Are you sure you want to add an assignment to Module <?php echo $row_modules['mid']; ?>?')">Add an Assignment to Module <?php echo $row_modules['mid']; ?>?</a></td>

    </tr>
	<?php do { ?>
    <input type="hidden" name="id_a[]" value="<?php echo $row_assignments['id']; ?>" />
	<tr>
		<td class="data" nowrap="nowrap" style="vertical-align: middle;">Assignment <?php echo $row_modules['mid'].".";?><input name="assign_num<?php echo $row_assignments['id']; ?>" type="text" size="2" value="<?php echo $row_assignments['assign_num']; ?>" />:</td>
       	<td class="data" width="35%" nowrap="nowrap"><input name="assign_title<?php echo $row_assignments['id']; ?>" type="text" size="50" value="<?php echo $row_assignments['assign_title']; if (($go == "setup") && ($row_assignments['assign_num'] == "1")) echo $row_pd_title['pd_name']; ?>" /></td>
        <td class="data"><?php if ($row_assignments['assign_num'] > "2") { ?><span class="icon"><img src="images/bin_closed.png" border="0" align="absmiddle" /></span><a href="javascript:confirmation('includes/process.inc.php?action=delete&dbTable=assignments','id','<?php echo $row_assignments['id']; ?>','Are you sure want to delete Module <?php echo $row_modules['mid']; ?>, Assignment <?php echo $row_modules['mid'].".".$row_assignments['assign_num']; ?>?')">Delete?</a><?php } else echo "&nbsp;"; ?></td>
        <td class="data">&nbsp;</td>
	</tr>
	<?php } while ($row_assignments = mysql_fetch_assoc($assignments)); ?>
</table>
<div class="stacked">
<span class="icon"><img src="images/disk.png" border="0" align="absmiddle" /></span><input id="Submit" name="Submit" type="submit" class="save_progress_form" value="<?php if (($action == "edit") || ($go == "missing")) echo "Update"; else echo "Save"; ?>">
</div>
<?php 
include (PROPOSAL.'display_map.sec.php');
include (PROPOSAL.'display_lo.sec.php'); 
?>
<?php } 
}
?>